<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改商品信息')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-product-edit" th:object="${product}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">商品名称
                ：</label>
            <div class="col-sm-8">
                <input name="productName" th:field="*{productName}" class="form-control"
                       type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">商品类别
                ：</label>
            <div class="col-sm-8">
                <input name="categoryId" th:field="*{categoryId}" class="form-control"
                       type="text" required>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">商品状态：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('product_sale_status')}">
                    <input type="radio" th:id="${'productStatus_' + dict.dictCode}" name="productStatus"
                           th:value="${dict.dictValue}" th:field="*{productStatus}" required>
                    <label th:for="${'productStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">关键字
                ：</label>
            <div class="col-sm-8">
                <input name="kayword" th:field="*{kayword}" class="form-control"
                       type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">商品单位
                ：</label>
            <div class="col-sm-8">
                <input name="productUnit" th:field="*{productUnit}" class="form-control"
                       type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">商品简介
                ：</label>
            <div class="col-sm-8">
                <input name="productBrief" th:field="*{productBrief}" class="form-control"
                       type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">货号
                ：</label>
            <div class="col-sm-8">
                <input name="productSn" th:field="*{productSn}" class="form-control"
                       type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">条形码
                ：</label>
            <div class="col-sm-8">
                <input name="barCode" th:field="*{barCode}" class="form-control"
                       type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script type="text/javascript">
    var prefix = ctx + "product/product";
    $("#form-product-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-product-edit').serialize());
        }
    }
</script>
</body>
</html>